<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>卖家-修改个人信息</title>
<link href="<?php echo $this->_webroot('/user/css/common.css'); ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->_webroot('/user/css/content1.css'); ?>" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->_webroot('/user/js/jquery-1.7.1.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->_webroot('/user/js/common.js'); ?>" type="text/javascript"></script>
</head>
<body>
<psp:tags     htmlname='user_topnav1'  iconname='usertopnav1' />
<psp:tags     htmlname='user_topsearch'  iconname='usertopsearch' />

<div class="main">
	<div class="main-left">
    	<div class="title">会员管理中心</div>
        <psp:tags     htmlname='user_menulist'  iconname='usermenulist' />
    </div>
<link href="<?php echo $this->_webroot('/user/css/shoprequest.css'); ?>" rel="stylesheet" type="text/css" />   
    <div class="main-right main_right">
	

	
<div class="cont">
                <div class="cont_title">创建店铺</div>
			     <div id="stepTip">
			      <ul class="list_step clearfix">
			     <li>第一步:<br>填写店主信息</li>
			     <li class="now">第二步:<br>填写店铺信息</li>
			     <li>第三步:<br>管理员审核</li>
			     <li style="padding-right:0">第四步:<br>完成</li>
			     </ul>
			     </div>
               
				<form method="post" name="form_shop_create" onsubmit="return checkForm();" action="<?php echo $this->_url('user/shoprequest');?>">

                <table width="100%" cellspacing="0" border="0">
				<tbody>
				<tr><td width="15%" class="textright">店铺名称:</td>
					<td><input type="text" maxlength="50" style="width:250px;" value="<?php echo $oneshopinfo['shopinfo']['shop_name']; ?>" name="data[shopinfo][shop_name]">
						<span class="red"><?php echo $errormsg;?>*</span></td></tr>
				<tr><td width="15%" class="textright">店铺分类:</td>
						<td style="float:none;">
							<span id="shop_country">
								<select name="data[shopinfo][categories_parent]" onchange="categorieschanged(this.value)">
									<option value='0'>选择分类</option>
									<?php  foreach($shop_categories_parent as $v) {?>
										<option value="<?php echo  $v['shopcategories']['id'];?>" ><?php echo  $v['shopcategories']['cat_name'];?></option>
									<?php }?>
								</select>
							</span>
							<span id="shop_categories">
	
							</span>
						<span class="red">*</span>
						</td>
				</tr>
				<tr>
					<td class="textright">所在地区:</td>
					<td>
					
								<span id="user_country">
								<select name="data[shopinfo][shop_country]" onchange="areachanged(this.value,0);">
									<option value='0'>选择国家</option>
								 <?php   foreach($areas_info[0] as $v){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$oneshopinfo[shopinfo]['shop_country']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php }?>
								</select>
								</span>
								
								<span id="user_province"><?php  if($oneshopinfo[shopinfo]['shop_country']){?>
								<select name="data[shopinfo][shop_province]" onchange="areachanged(this.value,1);">
									<option value='0'>选择省份</option>
								<?php foreach($areas_info[1] as $v) {
										if($v['parent_id'] == $oneshopinfo[shopinfo]['shop_country']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$oneshopinfo['shopinfo']['shop_province']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
								
								<span id="user_city">
								<?php 	 if($oneshopinfo[shopinfo]['shop_province']){?>
								<select name="data[shopinfo][shop_city]" onchange="areachanged(this.value,2);">
									<option value='0'>选择城市</option>
								    <?php foreach($areas_info[2] as $v) {
										if($v['parent_id'] == $oneshopinfo[shopinfo]['shop_province']){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$oneshopinfo[shopinfo]['shop_city']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?></select>
								<?php }?>
								</span>
								
								<span id="user_district">
								<?php  if($oneshopinfo[shopinfo]['shop_city']) {?>
								<select name="data[shopinfo][shop_district ]">
									<option value='0'>选择地区</option>
								<?php foreach($areas_info[3] as $v) {
										if($v['parent_id'] == $oneshopinfo[shopinfo]['shop_city']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$oneshopinfo[shopinfo]['shop_district']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
					<span class="red">*</span></td>
				</tr>
				<tr><td class="textright">详细地址:</td><td><input type="text" maxlength="200" style="width:250px;" value="<?php echo $oneshopinfo['shopinfo']['shop_address']; ?>" name="data[shopinfo][shop_address]"> <span class="red">*</span></td></tr>
				<tr><td class="textright">经营范围:</td><td><input type="text" maxlength="200" style="width:250px;" value="<?php echo $oneshopinfo['shopinfo']['shop_management']; ?>" name="data[shopinfo][shop_management]"> <span class="red">*</span></td></tr>
				<tr><td class="textright">选择模板:</td><td class="templageimg">
<?php
$shoptemplate_arr[] = array(
	'imgurl' => 'skin/default/images/default_small.gif',
	'bigimgurl' => 'skin/default/images/default.gif',
	'tpltag' => 'default',
	'tplname' => '默认模板'
);

?>				
				<?php $num=0;  foreach($shoptemplate_arr as $v) { $num++;?>
					<span><img src="<?php echo  $v['imgurl'];?>" width="95" alt="<?php echo  $v['tplname'];?>" onclick="wshowimg('<?php echo  $v['bigimgurl'];?>')" onmouseover="imgmover(this)" onmouseout="imgmout(this)" onerror="this.src='<?php echo $this->_webroot('/user/images/nopic.gif'); ?>'"/><br /><input type="radio" name="data[shopinfo][shop_template]" value="<?php echo  $v['tpltag'];?>" <?php  if($oneshopinfo['shopinfo']['shop_template']==$v['tpltag']) {?> checked<?php } else if(empty($oneshopinfo['shopinfo']['shop_template'])&& $num==1) {?> checked<?php }?> /> <?php echo  $v['tplname'];?></span>
				<?php }?>								</td></tr>
				<tr style="line-height:18px;"><td class="textright">店铺简介:</td><td>
                <textarea name="data[shopinfo][shop_intro]" id="shop_intro" cols="75" rows="5"><?php echo $oneshopinfo['shopinfo']['shop_intro']; ?></textarea>
				</td></tr>
				<tr><td align="center" colspan="2" style="text-align:center">
				<input type="hidden" value="<?php echo $userid; ?>" name="data[shopinfo][user_id]">
				<input type="hidden" value="2" name="data[step]">
				<input type="submit" value="创建店铺" name="submit">
				</td></tr>
			</tbody></table>				
				
				</form>
            </div>	
	
	

        

    </div>
    <div class="clear"></div>
</div>

<div class="footer">
    <psp:tags     htmlname='user_footer_helper'  iconname='userfooterhelper' />

</div>

<div id="showimg" style="display:none; width:408px; text-align:center; border:5px solid #F6A248; position:absolute; padding:4px; background:#fff; top:200px;"><img id="imgsrc" src="skin/default/images/shop_template_default_big.gif" width="400" /></div>
<div style="width:0px; height:0px; overflow:hidden;"><input type="input" id="hiddeninput" onblur="whideimg()" /></div>
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js');?>"></script>
<script language="JavaScript">
<!--
var utype = '';
function areachanged(value,type){
	if(value > 0) {	
		ajax("<?php echo $this->_url('user/getareas');?>","POST","value="+value+"&mode=shopinfo&pre=shop_&type="+type,function(return_text){
			var return_text = return_text.replace(/[\n\r]/g,"");
			if(return_text==""){
				alert("请重新选择!！");
			} else {
				if(type==0) {
					document.getElementById("user_province").innerHTML = return_text;
					show("user_province");
					hide("user_city");
					hide("user_district");
				} else if(type==1) {
					document.getElementById("user_city").innerHTML = return_text;
					show("user_city");
					hide("user_district");
				} else if(type==2) {
					document.getElementById("user_district").innerHTML = return_text;
					show("user_district");
				}
			}
		});
	} else {
		if(type==2) {
			hide("user_district");
		} else if(type==1) {
			hide("user_district");
			hide("user_city");
		} else if(type==0) {
			hide("user_district");
			hide("user_city");
			hide("user_province");
		}
	}
}




function categorieschanged(value){
	if(value > 0) {
		ajax("<?php echo $this->_url('user/getshopcategories');?>","POST","mode=shopinfo&value="+value,function(return_text){
			return_text = return_text.replace(/[\n\r]/g,"");
			document.getElementById("shop_categories").innerHTML = return_text;
			show("shop_categories");
		});
	}
}


function hide(id) {
	document.getElementById(id).style.display = 'none';
}
function show(id) {
	document.getElementById(id).style.display = '';
}


function checkForm() {
	var shop_name = document.getElementsByName("shop_name")[0];
	var shop_address = document.getElementsByName("shop_address")[0];
	var shop_management = document.getElementsByName("shop_management")[0];
	if(shop_name.value=='') {
		alert("店铺名称不能为空！");
		shop_name.focus();
		return false;
	} else if(document.getElementsByName("country")[0].value==0) {
		alert("请选择国家！");
		return false;
	} else if(document.getElementsByName("province")[0].value==0) {
		alert("请选择省份！");
		return false;
	} else if(document.getElementsByName("city")[0].value==0) {
		alert("请选择城市！");
		return false;
	} else if(document.getElementsByName("district")[0].value==0) {
		alert("请选择地区！");
		return false;
	} else if(shop_address.value=='') {
		alert("详细地址不能为空！");
		shop_address.focus();
		return false;
	} else if(shop_management.value=='') {
		alert("主要经营范围不能为空！");
		shop_management.focus();
		return false;
	}
	return true;
}

function imgmover(obj) {
	obj.style.border = '2px solid #E38016';
}

function imgmout(obj) {
	obj.style.border = '2px solid #eee';
}

function wshowimg(v) {
	var width = document.body.clientWidth;
	var showimg = document.getElementById("showimg");
	var imgsrc = document.getElementById("imgsrc");

	var left = "100";
	if(width) {
		left = (width-400)/2;
	}
	showimg.style.left = left+"px";
	showimg.style.display = '';
	imgsrc.src = v;
	document.getElementById("hiddeninput").focus();
}

function whideimg() {
	var showimg = document.getElementById("showimg");
	showimg.style.display = 'none';
}
//-->
</script>
</body>
</html>s